﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using V = Science.Mathematics.VectorCalculus;

namespace VectorCalculus5Ed.Chapter3.Section2
{
    public class Example04
    {
        public Example04()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
        public void Compute()
        {
            V.Function.ToLastType<double[], double> f
                = new V.Function.ToLastType<double[], double>(func);
            double[] at = { 4.0, 6.0 };
            double[] h = { -0.02, -0.03 };
            double[] x = { 3.98, 5.97};
            V.TaylorFormula obj = new V.TaylorFormula(f, at, h);
            obj.Compute();
            result += obj.Result.ToString() + "\r\n";
            result += (func(x)).ToString() + "\r\n";
        }
        private double func(double[] x)
        {
            return (x[0] - 1.0) * (x[0] - 1.0) / (x[1] - 3.0) / (x[1] - 3.0);
        }
    }
}
// 1.00674444444675
// 1.00674534344568

